const app = getApp();

// 没有export deafult的文件，前面引用要加大括号
export function groups_base_info() 
{
	return new Promise((resolve, reject) => {
		const value = uni.getStorageSync('groups_lang_info');
		if (value) {
			resolve(value);
		}else{
			// 加载loding
			uni.request({
			    url: app.globalData.get_request_url('base', 'index', 'groups'),
			    method: 'POST',
			    data: {},
			    dataType: 'json',
			    success: (res) => {console.log(res);
			        if (res.data.code == 0) {
			            var data = res.data.data;
						var lang_info = {};
						if((data || null) != null && (data.groups_lang_info || null) != null)
						{
							lang_info = data.groups_lang_info;
						}
						uni.setStorageSync('groups_lang_info', lang_info);
						resolve(lang_info);
			        }else{
						reject(res.data.msg);
					}
			    }
			});
		}
	});
}
export function clear_user_cach() 
{
	return new Promise((resolve, reject) => {
		// 用户登录缓存
		uni.removeStorageSync(app.globalData.data.cache_user_login_key);
		// 用户信息缓存
		uni.removeStorageSync(app.globalData.data.cache_user_info_key);
			
		resolve(1);
	});
}